package com.yanfan.ba.service.impl;

import java.util.Arrays;
import java.util.List;
import com.yanfan.common.utils.DateUtils;
import com.yanfan.common.utils.StringUtils;
import org.springframework.transaction.annotation.Transactional;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.yanfan.ba.mapper.NjBaDeviceMapper;
import com.yanfan.ba.domain.NjBaDevice;
import com.yanfan.ba.service.INjBaDeviceService;

/**
 * 楼控设备Service业务层处理
 *
 * @author genluo
 * @date 2024-11-06
 */
@Service
public class NjBaDeviceServiceImpl extends ServiceImpl<NjBaDeviceMapper, NjBaDevice> implements INjBaDeviceService {
    @Autowired
    private NjBaDeviceMapper njBaDeviceMapper;


    /**
     * 查询楼控设备列表
     *
     * @param njBaDevice 楼控设备
     * @return 楼控设备
     */
    @Override
    public List<NjBaDevice> queryPageList(NjBaDevice njBaDevice) {
        LambdaQueryWrapper<NjBaDevice> lqw = buildQueryWrapper(njBaDevice);
        return njBaDeviceMapper.selectList(lqw);
        //连表查询可用该方法，在此方法SQL语句上进行扩展
        //return njBaDeviceMapper.queryPageList(njBaDevice);
    }

    /**
    * 分页查询条件
    * @return
    */
    private LambdaQueryWrapper<NjBaDevice> buildQueryWrapper(NjBaDevice bo) {
        LambdaQueryWrapper<NjBaDevice> lqw = Wrappers.lambdaQuery();
        lqw.like(StringUtils.isNotBlank(bo.getDeviceName()), NjBaDevice::getDeviceName, bo.getDeviceName());
        return lqw;
    }



}
